<script setup>
import useRegister from '@/hooks/useRegister';
import eventActionDefinitions from './eventActionDefinitions';

const { ref, reactive, onMounted, useAttrs } = Vue3;

const props = defineProps({
  customConfig: Object,
  triggerEvent: Function,
  componentId: String,
});
const attrs = useAttrs();
const newProps = reactive({ ...props, ...attrs });

// action样例
const do_EventCenter_message = ({ value }) => {
  alert(value);
};

const handleClick = () => {
  number.value++;
  newProps.triggerEvent?.('click', { value: number.value });
};

const actions = {
  do_EventCenter_message,
};

useRegister(newProps, actions, eventActionDefinitions);

const number = ref(0);

onMounted(() => {
  // eslint-disable-next-line no-unused-vars
  newProps.eventBus?.on(newProps => {});
});
</script>

<template>
  {{ number }}
  <el-button @click="handleClick">逻辑控制事件触发样例</el-button>
</template>
